// index.js
// 获取应用实例
const app = getApp()
console.log('app',app)

Page({
  data: {
    motto: '你好~~这是一个小程序开始页~~',
    indicatorDots: true,
    vertical: false,
    autoplay: true,
    interval: 2000,
    duration: 500,
    userInfo: {},
    background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
    bannerImg: '../../images/banner.png',
    bannerData: [
      "../../images/banner.png",
      "../../images/banner1.png",
      "../../images/banner3.png"
    ]
  },
  // 事件处理函数
  onLoad() {

  },
  onShareAppMessage: function (options) {
    var _this = this;
    var shareObj = {
      title: app.globalData.shareObj.title,
      path: app.globalData.shareObj.path,
      imageUrl: app.globalData.shareObj.img,
      success: function (res) {
        if (res.errMsg == 'shareAppMessage:ok') {
          wx.showToast({
            title: '分享成功',
          })
        }
      },
      fail: function () {
        if (res.errMsg == 'shareAppMessage:fail cancel') {
          // 用户取消转发
        } else if (res.errMsg == 'shareAppMessage:fail') {
          // 转发失败，其中 detail message 为详细失败信息
        }
      }
    }
    return shareObj
  },
  onShareTimeline: function () {
    return {
      title: app.globalData.shareObj.title,
      path: app.globalData.shareObj.path,
      imageUrl: app.globalData.shareObj.img,
      query: 'kjbfrom=pyq'
    }
  }
})